<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_footer
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;
$db = &JFactory::getDBO();
$query = 'select * from #__categories where parent_id="32" and published=1 order by id asc';
$db->setQuery( $query );
$menuitem = $db->loadObjectList();
$n=0;
for($k=0;$k<count($menuitem);$k++){
	$query0 = 'select * from #__content where catid="'.$menuitem[$k]->id.'" and state=1 order by id asc';
	$db->setQuery( $query0 );
	$allcontent = $db->loadObjectList();
	$n+=count($allcontent);
}

?>
<div class="menucategories">
	<h2><?php echo JText::_('Categories');?> ( <?php echo $n;?> <?php echo JText::_('vacancies');?> )</h2>
    <div class="categoryitem">
		<?php
        for($i=0;$i<count($menuitem);$i++){
        ?>
            <a href="index.php?option=com_content&view=category&layout=blog&id=<?php echo $menuitem[$i]->id; ?>&Itemid=134">
                <?php echo $menuitem[$i]->title; ?> 
                (<?php 
						$query1 = 'select * from #__content where catid="'.$menuitem[$i]->id.'" and state=1 order by id asc';
						$db->setQuery( $query1 );
						$itemallcontent = $db->loadObjectList();
						echo count($itemallcontent);
				?>)
            </a>            
        <?php
        }
        ?>
	</div>
</div>
